
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module server</title>
<style type="text/css"><!--
TT { font-family: lucidatypewriter, lucida console, courier }
--></style></head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>server</strong></big></big> (May 3rd, 2004)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/todd/release/pdb2pqr/server.py">/home/todd/release/pdb2pqr/server.py</a></font></td></tr></table>
    <p><tt>CGI&nbsp;Server&nbsp;for&nbsp;PDB2PQR<br>
&nbsp;<br>
This&nbsp;module&nbsp;contains&nbsp;the&nbsp;various&nbsp;functions&nbsp;necessary&nbsp;to&nbsp;run&nbsp;PDB2PQR<br>
from&nbsp;a&nbsp;web&nbsp;server.</tt></p>

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="string.html">string</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top><a href="time.html">time</a><br>
</td></tr></table></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;&nbsp;</td>
<td width="100%"><dl><dt><a name="-cleanTmpdir"><strong>cleanTmpdir</strong></a>()</dt><dd><tt>Clean&nbsp;up&nbsp;the&nbsp;temp&nbsp;directory&nbsp;for&nbsp;CGI.&nbsp;&nbsp;If&nbsp;the&nbsp;size&nbsp;of&nbsp;the&nbsp;directory<br>
is&nbsp;greater&nbsp;than&nbsp;LIMIT,&nbsp;delete&nbsp;the&nbsp;older&nbsp;half&nbsp;of&nbsp;the&nbsp;files.&nbsp;&nbsp;Since<br>
the&nbsp;files&nbsp;are&nbsp;stored&nbsp;by&nbsp;system&nbsp;time&nbsp;of&nbsp;creation,&nbsp;this&nbsp;is&nbsp;an<br>
easier&nbsp;task.</tt></dd></dl>
 <dl><dt><a name="-createError"><strong>createError</strong></a>(name, details)</dt><dd><tt>Create&nbsp;an&nbsp;error&nbsp;results&nbsp;page&nbsp;for&nbsp;CGI-based&nbsp;runs<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;result&nbsp;file&nbsp;root&nbsp;name,&nbsp;based&nbsp;on&nbsp;local&nbsp;time&nbsp;(string)<br>
&nbsp;&nbsp;&nbsp;&nbsp;details:&nbsp;The&nbsp;details&nbsp;of&nbsp;the&nbsp;error&nbsp;(string)</tt></dd></dl>
 <dl><dt><a name="-createResults"><strong>createResults</strong></a>(header, input, name, time)</dt><dd><tt>Create&nbsp;the&nbsp;results&nbsp;web&nbsp;page&nbsp;for&nbsp;CGI-based&nbsp;runs<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;header:&nbsp;The&nbsp;header&nbsp;of&nbsp;the&nbsp;PQR&nbsp;file&nbsp;(string)<br>
&nbsp;&nbsp;&nbsp;&nbsp;input:&nbsp;&nbsp;&nbsp;A&nbsp;flag&nbsp;whether&nbsp;an&nbsp;input&nbsp;file&nbsp;has&nbsp;been&nbsp;created&nbsp;(int)<br>
&nbsp;&nbsp;&nbsp;&nbsp;tmpdir:&nbsp;&nbsp;The&nbsp;resulting&nbsp;file&nbsp;directory&nbsp;(string)<br>
&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;result&nbsp;file&nbsp;root&nbsp;name,&nbsp;based&nbsp;on&nbsp;local&nbsp;time&nbsp;(string)<br>
&nbsp;&nbsp;&nbsp;&nbsp;time:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;taken&nbsp;to&nbsp;run&nbsp;the&nbsp;script&nbsp;(float)</tt></dd></dl>
 <dl><dt><a name="-getLoads"><strong>getLoads</strong></a>()</dt><dd><tt>Get&nbsp;the&nbsp;system&nbsp;load&nbsp;information&nbsp;for&nbsp;output&nbsp;and&nbsp;logging<br>
&nbsp;<br>
Returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;loads:&nbsp;&nbsp;A&nbsp;three&nbsp;entry&nbsp;list&nbsp;containing&nbsp;the&nbsp;1,&nbsp;5,&nbsp;and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15&nbsp;minute&nbsp;loads.&nbsp;If&nbsp;the&nbsp;load&nbsp;file&nbsp;is&nbsp;not&nbsp;found,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;None.</tt></dd></dl>
 <dl><dt><a name="-logRun"><strong>logRun</strong></a>(form, nettime, size)</dt><dd><tt>Log&nbsp;the&nbsp;CGI&nbsp;run&nbsp;for&nbsp;data&nbsp;analysis.&nbsp;&nbsp;Currently&nbsp;only&nbsp;log&nbsp;runs&nbsp;where<br>
the&nbsp;pdbid&nbsp;is&nbsp;specfied.&nbsp;&nbsp;Options&nbsp;are&nbsp;denoted&nbsp;as&nbsp;either&nbsp;a&nbsp;1&nbsp;or&nbsp;a&nbsp;0.<br>
Log&nbsp;file&nbsp;format&nbsp;is&nbsp;as&nbsp;follows:<br>
&nbsp;<br>
DATE&nbsp;&nbsp;&nbsp;&nbsp;PDB_ID&nbsp;&nbsp;&nbsp;&nbsp;SIZE&nbsp;&nbsp;&nbsp;&nbsp;DEBUMP_HEAVY&nbsp;DEBUMP_H&nbsp;OPT_PROT&nbsp;OPT_WAT&nbsp;&nbsp;&nbsp;&nbsp;TIME<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;form:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;CGI&nbsp;form&nbsp;with&nbsp;all&nbsp;set&nbsp;options&nbsp;(cgi)<br>
&nbsp;&nbsp;&nbsp;&nbsp;nettime:&nbsp;The&nbsp;total&nbsp;time&nbsp;taken&nbsp;for&nbsp;the&nbsp;run&nbsp;(float)<br>
&nbsp;&nbsp;&nbsp;&nbsp;size:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;initial&nbsp;number&nbsp;of&nbsp;non-HETATM&nbsp;atoms&nbsp;in&nbsp;the&nbsp;PDB&nbsp;file&nbsp;(int)</tt></dd></dl>
 <dl><dt><a name="-printAcceptance"><strong>printAcceptance</strong></a>(name)</dt><dd><tt>Print&nbsp;the&nbsp;first&nbsp;message&nbsp;to&nbsp;stdout&nbsp;(web&nbsp;browser)&nbsp;-&nbsp;set&nbsp;the<br>
refresh&nbsp;to&nbsp;the&nbsp;&lt;id&gt;-tmp.html&nbsp;file.<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;ID&nbsp;of&nbsp;the&nbsp;HTML&nbsp;page&nbsp;to&nbsp;redirect&nbsp;to&nbsp;(string)</tt></dd></dl>
 <dl><dt><a name="-printProgress"><strong>printProgress</strong></a>(name, refreshname, reftime, starttime)</dt><dd><tt>Print&nbsp;the&nbsp;progress&nbsp;of&nbsp;the&nbsp;server<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;ID&nbsp;of&nbsp;the&nbsp;HTML&nbsp;page&nbsp;to&nbsp;write&nbsp;to&nbsp;(string)<br>
&nbsp;&nbsp;&nbsp;&nbsp;refreshname:&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;HTML&nbsp;page&nbsp;to&nbsp;refresh&nbsp;to&nbsp;(string)<br>
&nbsp;&nbsp;&nbsp;&nbsp;reftime:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;length&nbsp;of&nbsp;time&nbsp;to&nbsp;set&nbsp;the&nbsp;refresh&nbsp;wait&nbsp;to&nbsp;(int)<br>
&nbsp;&nbsp;&nbsp;&nbsp;starttime:&nbsp;&nbsp;&nbsp;The&nbsp;time&nbsp;as&nbsp;returned&nbsp;by&nbsp;time.time()&nbsp;that&nbsp;the&nbsp;run&nbsp;started&nbsp;(float)</tt></dd></dl>
 <dl><dt><a name="-setID"><strong>setID</strong></a>(time)</dt><dd><tt>Given&nbsp;a&nbsp;floating&nbsp;point&nbsp;time.time(),&nbsp;generate&nbsp;an&nbsp;ID.<br>
Use&nbsp;the&nbsp;tenths&nbsp;of&nbsp;a&nbsp;second&nbsp;to&nbsp;differentiate.<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;time:&nbsp;&nbsp;The&nbsp;current&nbsp;time.time()&nbsp;(float)<br>
Returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;:&nbsp;&nbsp;The&nbsp;file&nbsp;id&nbsp;(string)</tt></dd></dl>
 <dl><dt><a name="-startServer"><strong>startServer</strong></a>(name)</dt><dd><tt>Start&nbsp;the&nbsp;PDB2PQR&nbsp;server.&nbsp;&nbsp;This&nbsp;function&nbsp;is&nbsp;necessary&nbsp;so<br>
that&nbsp;useful&nbsp;information&nbsp;can&nbsp;be&nbsp;displayed&nbsp;to&nbsp;the&nbsp;user&nbsp;-&nbsp;otherwise<br>
nothing&nbsp;would&nbsp;be&nbsp;returned&nbsp;until&nbsp;the&nbsp;complete&nbsp;run&nbsp;finishes.<br>
&nbsp;<br>
Parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;ID&nbsp;name&nbsp;of&nbsp;the&nbsp;final&nbsp;file&nbsp;to&nbsp;create&nbsp;(string)<br>
Returns<br>
&nbsp;&nbsp;&nbsp;&nbsp;pqrpath:&nbsp;The&nbsp;complete&nbsp;path&nbsp;to&nbsp;the&nbsp;pqr&nbsp;file&nbsp;(string)</tt></dd></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;&nbsp;</td>
<td width="100%"><strong>LIMIT</strong> = 500.0<br>
<strong>LOADPATH</strong> = '/proc/loadavg'<br>
<strong>LOCALPATH</strong> = '/home/todd/public_html/pdb2pqr/'<br>
<strong>LOGPATH</strong> = '/home/todd/public_html/pdb2pqr/log/pdb2pqr.log'<br>
<strong>REFRESHTIME</strong> = 20<br>
<strong>STYLESHEET</strong> = 'http://agave.wustl.edu/css/baker.css'<br>
<strong>TMPDIR</strong> = 'tmp/'<br>
<strong>WEBSITE</strong> = 'http://ocotillo.wustl.edu/~todd/pdb2pqr/'<br>
<strong>__author__</strong> = 'Todd Dolinsky'<br>
<strong>__date__</strong> = 'May 3rd, 2004'<br>
<strong>__file__</strong> = './server.pyc'<br>
<strong>__name__</strong> = 'server'</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;&nbsp;</td>
<td width="100%">Todd&nbsp;Dolinsky</td></tr></table>
</body></html>